Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.cetask
Class TaskEngine

    java.lang.Object
      edu.wpi.cetask.TaskEngine

    public class TaskEngine

extends Object

Nested Class Summary
`static interface` | `TaskEngine.OnParsing` Interface for `setOnParsing(OnParsing)` callback.

Field Summary
`static boolean` | `DEBUG`
`static boolean` | `VERBOSE`

Constructor Summary
`TaskEngine()`
`TaskEngine(String platform, String deviceType)` Create a new task recognizer with given default values for platform and deviceType.

Method Summary
`void` | `addTop(Plan plan)` Add given plan to current task tree at toplevel.
`void` | `clear()`
`void` | `decomposeAll()` Call `Plan.decomposeAll()` on all plans in current tree.
`Object` | `eval(String script, javax.script.Bindings bindings, String where)`
`Object` | `evalGlobal(String script, String where)`
`List<Plan>` | `findMatches(Task task, boolean onlyLive)` Return list of plans in task tree with goal matching given task, searching in the following categories, in order: within current focus within current toplevel plan any toplevel plan If matching plans are found in one category, search does not continue to next category.
`String` | `getDeviceType(Task task)`
`Plan` | `getFocus()` Return the current focus in the task tree, or null if no focus. Note that this is not the discourse concept of focus (cf.
`TaskModel` | `getModel(String namespace)` Return task model for given namespace.
`static String` | `getNamespace()`
`String` | `getPlatform(Task task)`
`String` | `getProperty(String key)`
`javax.script.ScriptEngine` | `getScriptEngine()`
`long` | `getStart()`
`Plan` | `getTop(Plan plan)`
`Plan` | `newFocus(Plan plan)` Return first ancestor of given plan which is live or has live descendants, stopping at toplevel plan containing given plan, or null if none.
`TaskModel` | `parse(String uri)` Load and return task model from XML document at given URI
`void` | `removeTop(Plan plan)` Remove given toplevel plan from current tree.
`boolean` | `setFocus(Plan focus)` Shift focus to the given plan or null.
`void` | `setOnParsing(TaskEngine.OnParsing callback)` Set object to be called after new task model loaded.
`void` | `setStart(long start)` Set the start time to be used for 'when' slot in verbose version of `Instance.toString()`.
`Iterator<Plan>` | `tops()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### VERBOSE

    public static boolean VERBOSE

### DEBUG

    public static boolean DEBUG

Constructor Detail

### TaskEngine

    public TaskEngine(String platform,
                      String deviceType)

  Create a new task recognizer with given default values for platform and deviceType. Note that how platforms and deviceTypes are associated with tasks is outside the scope of the standard, and is not addressed by this implementation.

### TaskEngine

    public TaskEngine()

Method Detail

### getDeviceType

    public String getDeviceType(Task task)

### getPlatform

    public String getPlatform(Task task)

### getScriptEngine

    public javax.script.ScriptEngine getScriptEngine()

### eval

    public Object eval(String script,
                       javax.script.Bindings bindings,
                       String where)
                throws javax.script.ScriptException

  Throws:
    `javax.script.ScriptException`

### evalGlobal

    public Object evalGlobal(String script,
                             String where)
                      throws javax.script.ScriptException

  Throws:
    `javax.script.ScriptException`

### getNamespace

    public static String getNamespace()

### getProperty

    public String getProperty(String key)

### parse

    public TaskModel parse(String uri)

  Load and return task model from XML document at given URI

### setOnParsing

    public void setOnParsing(TaskEngine.OnParsing callback)

  Set object to be called after new task model loaded.

### getModel

    public TaskModel getModel(String namespace)

  Return task model for given namespace. If such a model has not already been loaded, resolve namespace and load.

### getStart

    public long getStart()

  See Also:
    `setStart(long)`

### setStart

    public void setStart(long start)

  Set the start time to be used for 'when' slot in verbose version of `Instance.toString()`. If start time is greater than zero, then shows 'when' in seconds since start time, rather than UTC in milliseconds.

  Parameters:
    `start` - - start time in milliseconds (e.g., `System.currentTimeMillis()`)
  See Also:
    `VERBOSE`

### clear

    public void clear()

### getFocus

    public Plan getFocus()

  Return the current focus in the task tree, or null if no focus.
  Note that this is not the discourse concept of focus (cf. Collagen), but rather a much simpler "execution" focus. For example, there is no focus stack. Also, the focus will not usually not be on a done plan. Management of the focus is the responsibility of the application using the recognizer, with the exception of `addTop(Plan)` and `removeTop(Plan)`, as documented.
  Note also that this is not the same as the "next" live action, since in a partially ordered plan, there may be several next actions to choose from. The current focus will usually have the next live actions as its children.

  See Also:
    `setFocus(Plan)`

### setFocus

    public boolean setFocus(Plan focus)

  Shift focus to the given plan or null.

  Returns:
    true iff this is an "unexpected focus shift" in the sense of Lesh, Rich & Sidner's UM'01 paper, i.e., we are leaving the current focus when it is started but not done.
  See Also:
    `getFocus()`

### tops

    public Iterator<Plan> tops()

### addTop

    public void addTop(Plan plan)

  Add given plan to current task tree at toplevel. Shifts the focus to this plan if it is not done.

### removeTop

    public void removeTop(Plan plan)

  Remove given toplevel plan from current tree. Also sets focus to null, if given plan was focus.

### getTop

    public Plan getTop(Plan plan)

### newFocus

    public Plan newFocus(Plan plan)

  Return first ancestor of given plan which is live or has live descendants, stopping at toplevel plan containing given plan, or null if none.

### findMatches

    public List<Plan> findMatches(Task task,
                                  boolean onlyLive)

  Return list of plans in task tree with goal matching given task, searching in the following categories, in order:
  1. within current focus
  2. within current toplevel plan
  3. any toplevel plan
  If matching plans are found in one category, search does not continue to next category.

  Parameters:
    `onlyLive` - only search live plans

### decomposeAll

    public void decomposeAll()

  Call `Plan.decomposeAll()` on all plans in current tree.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD